﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Main : MonoBehaviour
{
    public GameObject m_RandomFightB;
    public GameObject m_BattleB;
    public GameObject m_ChallengeSevenBaB;
    public GameObject m_ChallengeOtherPlayerB;
    public GameObject m_AndroidControle;
    public Button m_BackOnlineRoomB;

    public SceneSwiter m_Swticher;
    void Start()
    {
        m_BackOnlineRoomB.gameObject.SetActive(UtilsGame.IsOnline());
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void OnRandomFightClicked()
    {
        if (!UtilsGame.CheckSelectShip())
            return;
        m_Swticher.switchScene("RandomFight");
    }
    public void OnChangedFightClicked()
    {
        if (!UtilsGame.CheckSelectShip())
            return;
        //m_Swticher.switchScene("RandomFight");
    }

    public void OnQuitClicked()
    {
        Player.Instance.save();
        Commander.Instance.save();
#if UNITY_EDITOR
        UnityEditor.EditorApplication.isPlaying = false;
#else
        UnityEngine.Application.Quit(1);
#endif
    }


    public void OpenControle()
    {
#if UNITY_ANDROID
        m_AndroidControle.SetActive(true);
#endif
    }
    public void CloseControle()
    {
#if UNITY_ANDROID
        m_AndroidControle.SetActive(false);
#endif
    }
}
